//
//  JGSettingViewController.m
//  WangYLottery
//
//  Created by JJetGu on 15/8/23.
//  Copyright (c) 2015年 JJetGu. All rights reserved.
//

#import "JGSettingViewController.h"

#import "JGSettingItem.h"
#import "JGSettingGroup.h"

#import "JGSettingSwitchItem.h"
#import "JGSettingArrowItem.h"

#import "JGTestViewController.h"
#import "JGProductCollectionViewController.h"
#import "JGPushNoticeViewController.h"
#import "JGAboutViewController.h"
#import "JGHelpViewController.h"
#import "JGShareViewController.h"

@interface JGSettingViewController ()

@end

@implementation JGSettingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    // 0组
    [self addGroup0];
    
    // 1组
    [self addGroup1];
}

- (void)addGroup1
{
    // 1组
    JGSettingItem *newVersion = [JGSettingArrowItem itemWithIcon:@"MoreUpdate" title:@"检查新版本"];
    // 保存了一段检查更新的功能
    newVersion.option = ^{
        // 1.显示蒙板
        [MBProgressHUD showMessage:@"正在检查ing......."];
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            // 2.隐藏蒙板
            [MBProgressHUD hideHUD];
            
            // 3.提示用户
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"有更新版本" message:nil delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:@"立即更新", nil];
            // 显示UIAlertView
            [alert show];
            
        });
        
    };
    
    JGSettingItem *help = [JGSettingArrowItem itemWithIcon:@"MoreHelp" title:@"帮助" destVcClass:[JGHelpViewController class]];
    
    JGSettingItem *MoreShare = [JGSettingArrowItem itemWithIcon:@"MoreShare" title:@"分享" destVcClass:[JGShareViewController class]];
    JGSettingItem *MoreMessage = [JGSettingArrowItem itemWithIcon:@"MoreMessage" title:@"查看消息" destVcClass:[JGTestViewController class]];
    JGSettingItem *MoreNetease = [JGSettingArrowItem itemWithIcon:@"MoreNetease" title:@"产品推荐" destVcClass:[JGProductCollectionViewController class]];
    JGSettingItem *MoreAbout = [JGSettingArrowItem itemWithIcon:@"MoreAbout" title:@"关于" destVcClass:[JGAboutViewController class]];
    
    JGSettingGroup *group1 = [[JGSettingGroup alloc] init];
    group1.header = @"帮助";
    group1.items = @[newVersion,help,MoreShare,MoreMessage,MoreNetease,MoreAbout];
    
    
    [self.dataList addObject:group1];
}

- (void)addGroup0
{
    // 0组
    JGSettingArrowItem *pushNotice = [JGSettingArrowItem itemWithIcon:@"MorePush" title:@"推送和提醒" destVcClass:[JGPushNoticeViewController class]];
    
    
    JGSettingItem *yaoyiyao = [JGSettingSwitchItem itemWithIcon:@"handShake" title:@"摇一摇机选"];
    
    JGSettingItem *sound = [JGSettingSwitchItem itemWithIcon:@"sound_Effect" title:@"声音效果"];
    
    
    JGSettingGroup *group0 = [[JGSettingGroup alloc] init];
    group0.items = @[pushNotice,yaoyiyao,sound];
    
    [self.dataList addObject:group0];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
